<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增终端型号')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-model-add">
            <div class="form-group">
                <label class="col-sm-3 control-label  is-required">品牌名称：</label>
                <div class="col-sm-8">
                    <input name="manuName" onclick="selectManu()" readonly id="manuName" type="text" class="form-control" required>
                    <i class="fa fa-search" style="margin-top: -22px;margin-right:3px;float:right;"></i>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label  is-required">品牌代号：</label>
                <div class="col-sm-8">
                    <input name="manuCode"  readonly id="manuCode" type="text" class="form-control" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">终端型号：</label>
                <div class="col-sm-8">
                    <input name="model" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">机具类型：</label>
                <div class="col-sm-8">
                    <select name="type" readonly  class="form-control" th:with="type=${@dict.getType('terminal_type')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                                th:selected = "${dict.dictValue eq terminalModel?.type}" ></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">终端价格：</label>
                <div class="col-sm-8">
                    <input name="price"  class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">备注：</label>
                <div class="col-sm-8">
                    <input name="note" class="form-control" type="text" required>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: utils-js" />
    <script th:inline="javascript">
        var prefix = ctx + "terminal/model"
        $("#form-model-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                if (!$.vali.money($("input[name='price']").val())){
                    $.modal.alertError("请输入正确的售价");
                    return;
                }
                $.operate.save(prefix + "/add", $('#form-model-add').serialize());
            }
        }
        function selectManu() {
            var url = ctx + "terminal/manufacturer/selectManufacturer/";
            $.modal.open("选择厂商" , url, '700');
        }
    </script>
</body>
</html>
